using System;
using System.Data;
using System.Data.SqlClient;


/// <summary>
/// Summary description for SQLServer
/// </summary>
public partial class SQLServer 
{
    public DataTable GetJobPostingsByJobCategory(string jobCategoryID)
    {
        errorMessage = "";

        DataTable dataTable = new DataTable();
        try
        {
            OpenConnection();
            sqlCommand = new SqlCommand();
            sqlCommand.CommandText = "SPJobPostingsOfJobCategory";
            sqlCommand.Connection = sqlConnection;
            sqlCommand.CommandType =
            CommandType.StoredProcedure;
            sqlCommand.Parameters.AddWithValue(
            "@JobCategoryID", jobCategoryID);
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
            sqlDataAdapter.Fill(dataTable);
            sqlDataAdapter.Dispose();
            CloseConnection();
            
        }
        catch (SqlException sql)
        {
            errorCode = sql.Number;
            errorMessage = sql.Message;
        }
        catch (Exception ex)
        {
            errorMessage = ex.Message;

        }
        return dataTable;
    }
    
}
